<table class="show return-items-table">
  <thead>
    <tr>
      <th><%= Spree::Product.model_name.human %></th>
      <th><%= Spree::Variant.human_attribute_name(:sku) %></th>
      <th><%= Spree::ReturnItem.human_attribute_name(:amount) %></th>
      <th><%= Spree::ReturnItem.human_attribute_name(:preferred_reimbursement_type) %></th>
      <th><%= Spree::ReturnItem.human_attribute_name(:exchange_variant) %></th>
      <th><%= Spree::ReturnItem.human_attribute_name(:acceptance_status_errors) %></th>
      <th><%= Spree::ReturnItem.human_attribute_name(:reception_status) %></th>
      <% unless return_items.all?(&:received?)%>
        <th><%= Spree::ReturnItem.human_attribute_name(:item_received?) %></th>
      <% end %>
      <% if show_decision %>
        <th class="actions"></th>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% return_items.each do |return_item| %>
      <tr>
        <td>
          <div class="variant-name"><%= return_item.inventory_unit.variant.name %></div>
          <div class="variant-options"><%= return_item.inventory_unit.variant.options_text %></div>
        </td>
        <td>
          <%= return_item.inventory_unit.variant.sku %>
        </td>
        <td class="align-center">
          <%= return_item.display_amount %>
        </td>
        <td class="align-center">
          <%= reimbursement_type_name(return_item.preferred_reimbursement_type) %>
        </td>
        <td class="align-center">
          <%= return_item.exchange_variant.try(:exchange_name) %>
        </td>
        <td class="align-center">
          <%= return_item.acceptance_status_errors %>
        </td>
        <td class-"align-center">
          <%= return_item.reception_status.humanize %>
        </td>
        <% unless return_item.received? %>
          <td class='align-center'>
            <%= form_for [:admin, return_item] do |f| %>
              <%= f.hidden_field 'reception_status_event', value: 'receive' %>
              <%= f.button Spree.t('actions.receive'), class: 'with-tip', "data-action" => 'save' %>
            <% end %>
          </td>
        <% end %>
        <% if show_decision %>
          <td class='actions'>
            <%= button_to [:admin, return_item], { class: 'fa fa-thumbs-up icon_link no-text with-tip', params: { "return_item[acceptance_status]" => 'accepted' }, "data-action" => 'save', title: Spree.t(:accept), method: 'put' } do %>
              <%= Spree.t(:accept) %>
            <% end %>
            <%= button_to [:admin, return_item], { class: 'fa fa-thumbs-down icon_link no-text with-tip', params: { "return_item[acceptance_status]" => 'rejected' }, "data-action" => 'remove', title: Spree.t(:reject), method: 'put' } do %>
              <%= Spree.t(:reject) %>
            <% end %>
          </td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>
